package com.site.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by shengquan.wu on 2018/6/6.
 */
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private StringRedisTemplate strRedis;

    @RequestMapping("/test")
    public String test(){
        strRedis.opsForValue().set("demo-cache", "hello demo!!!222");

        return strRedis.opsForValue().get("demo-cache");
    }
}
